import homeConfig from "./homeConfig.js"

let homeRoutes = []

for (let path in homeConfig) {
    let paths = path.split("/");
    // console.log(paths);


    homeRoutes.push({
        path: path,
        component: homeConfig[path],
    })
}

homeRoutes.push({
    path: "/:error(.*)*",
    component: () => import("@/views/NotFound.vue")
});
homeRoutes.push({
    path: '/home/auth',
    component: () => import('@/views/AuthView.vue'),
})

export default [
    {
        path: "/",
        redirect: "/login",
        meta: {
            isPublic: true
        }
    },
    {
        path: "/login",
        name: "login",
        component: () => import("@/views/LoginView.vue"),
        meta: {
            isPublic: true
        }
    },
    {
        path: "/home",
        name: "home",
        children: homeRoutes,
        component: () => import("@/views/HomeView.vue"),

    },
    {
        path: '/:error(.*)*',
        redirect: '/login',
        meta: {
            isPublic: true,
        },
    }

]